package com.oocl.zero.task0710.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class RegexDemo {
	public static final String CHINESE_CHARACTERS_PATTERN = "[\u4e00-\u9fa5]";
	public static final String LOWERCASE_LETTERS_PATTERN = "[a-z]";
	public static final String UPCASE_LETTERS_PATTERN = "[A-Z]";
	public static final String NUMBER_PATTERN = "[0-9]";
	public static final String PUNCTUATION_PATTERN = "[\\pP‘’“”]";
	
	public static int getCount(String input,String regex){
		if(input==null){
			throw new RuntimeException("input is null");
		}
		int count=0;
		Pattern p=Pattern.compile(regex);
		Matcher m = p.matcher(input);
		while( m.find() ){
			++count;
		}
		return count;	
	}
}
